<?php
include("cabecalho.php");

// ------------------------------------------Preenche select instituição ---
$selectinstituicao = "";
$objInstituicao = new Instituicao();
$inst = $objInstituicao->listar();                        // vem da classe
foreach ($inst as $item) {
    $selectinstituicao .= '<option value="' . $item->idinstituicao . '" >' . $item->nome_instituicao . '</option>';
}
// -----------------------------------------------Fim select instituição ---
?>

<!-- TROCADO POR BOOTSTRAP - Ricardo - 14/05/14
<br/>
    <h2>Cadastro de Usuario</h2>
    <a href="usuario.php"> Menu Usuário [ <== ]</a>
    <br/><br>-->
<br><br>
<div class="container">
    <div class="row">
        <div class="col-md-12 text-left">
            <div class="navbar navbar-default">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand">Cadastro de Usuário</a>
                </div>
                <div class="collapse navbar-collapse navbar-ex1-collapse">
                    <ul class="nav navbar-nav navbar-left">
                        <li><a href="usuario.php">Menu Usuário</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<!--TROCADO PARA BOOTSTRAP - Ricardo - 14/05/14
       <form action="usuario-add-ok.php" method="POST">
           <table >
           <tr>                                          <!-- Atributo nome
               <td align="right" width="25%"><label>Nome:</label></td>
               <td width="75%"><input type="text" name="nome_usuario" maxlength="150" autofocus required ></td>
            </tr>

            <tr>                                          <!-- Atributo senha
               <td align="right" width="25%"><label>Senha:</label></td>
               <td width="75%"><input type="text" name="senha_usuario" maxlength="100" required ></td>
            </tr>

            <tr>                                          <!-- Atributo email
               <td align="right" width="25%"><label>E-mail:</label></td>
               <td width="75%"><input type="email" name="email_usuario" maxlength="100" required ></td>
            </tr>

            <tr>                                         <!-- Atributo idinstituicao
                <td align="right" width="25%"><label>Instituição:</label></td>
                <td>
                    <select name="idinstituicao">
<?php //echo $selectinstituicao; ?>
                    </select>
                </td>
            </tr>

             <tr>                                          <!-- Atributo nivel ( 0=Adm 1=Prof 2=Aluno )
                <td align="right" width="25%"><label>Nivel:</label></td>
                <td>
                    <select name="nivel">
                        <option value="0" > 0-Administrador </option>
                        <option value="1" > 1-Professor </option>
                        <option value="2" selected > 2-Aluno </option>
                    </select>
                </td>
            </tr

            <tr>                                         <!-- Atributo permissao
                <td align="right" width="25%"><label>Permissao Acesso :</label></td>
                <td>
                    <select name="permissao">
                        <option value="true" > Sim </option>
                        <option value="false" selected > Nao </option>
                    </select>
                </td>
            </tr>


            <tr>
               <td align="right" width="25%"><input type="reset" value="Limpar"> </td>
               <td width="75%"><input type="submit" name="cadastrar" value="Cadastrar"></td>
            </tr>


       </table>
       </form>
-->

<div class="container">
    <div class="row">
        <div class="col-md-4"></div>
        <div class="col-md-4">
            <form role="form" action="usuario-add-ok.php" method="POST">
                <div class="form-group">
                    <label>Nome</label>
                    <input class="form-control" name="nome_usuario" autofocus required placeholder="Digite seu nome" maxlength="150" type="text">
                </div>
                <div class="form-group">
                    <label>Senha</label>
                    <input class="form-control" placeholder="Sua senha" type="text" name="senha_usuario" maxlength="100" required>
                </div>
                <div class="form-group">
                    <label>E-mail</label>
                    <input class="form-control" placeholder="Seu email" type="email" name="email_usuario" maxlength="100" required >
                </div>
                <div class="form-group">
                    <label>Instituição</label>
                    <select class="form-control" name="idinstituicao">
                        <?php echo $selectinstituicao; ?>
                    </select>
                </div>
                <div class="form-group">
                    <label>Nível</label>
                    <select class="form-control" name="nivel">
                        <option value="0" > 0-Administrador </option>
                        <option value="1" > 1-Professor </option>
                        <option value="2" selected > 2-Aluno </option>
                    </select>
                </div>
                <div class="form-group">
                    <label>Permissão de Acesso</label>
                    <select class="form-control" name="permissao">
                        <option value="true" > Sim </option>
                        <option value="false" selected > Nao </option>
                    </select>
                </div>
                <button type="submit" class="btn btn-success">Gravar</button>
                <button type="reset" class="btn btn-info">Limpar</button>
            </form>
        </div>
    </div>
</div>